home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 27.zip
/
BS1 part 27
/
ImageMaster_d3.adf
/
piarc.lzh.parta
/
GE_NMRRD.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-23
|
4KB
|
124 lines
/*
* GE_NMRRD.rexx
*
* Written by: Pete Patterson & Ben Williams
* Last Update: February 27th, 1993
* For: Black Belt Systems Amiga image processing software "IM"
* --------------------------------------------------------------------
* Revision: 2.00
*/
parse arg fullname
call pragma('stack',20000);
if ~show('L',"rexxsupport.library") then do
if ~addlib('rexxsupport.library',0,-30,0) then do
say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
say 'Cannot operate PI Modules without this library - sorry!';
'finish';
exit 10;
end;
end;
prtnme = 'IP_Port'; /* assume Image Professional */
if show('P','IP_Port') = 0 then do
if show('P','IM_Port') = 0 then do
say "Can't find image processor's ARexx port!!!"; /* not running? */
say "This script requires IP, IM or IM F/c to run!";
exit(20);
end;
else do
prtnme = 'IM_Port';
end;
end;
cmdpath = 'c:';
if open(fhandle,'rexx:picmdpath','read') then
do
cmdpath = readln(fhandle);
call close(fhandle);
end
if fullname = "" then
do
options results;
address command 'rx rxpi:GetFile.rexx';
if open(fhandle,'ram:IP_FNAME.tmp','read') then
do
fullname = readln(fhandle);
call close(fhandle);
end
end
thispath = gimmepath(fullname);
/* --------------------------------------------------------------------- */
/* ------------- BEGINNING of format-specific ARexx code --------------- */
/* --------------------------------------------------------------------- */
address command cmdpath||'GE_NMRRD c "'||fullname||'"';
if rc ~= 0 then do; address(prtnme); 'message "Cannot read '||fullname||' Error = '||rc||'"'; 'finish'; exit 0; end;
address(prtnme);
options results;
'askyn '||'"LO/HI byte order" "HI/LO byte order"'
hilo = result;
'askprop '||'"Ignore how many high order bits?" 3 0 4'
dbits = result;
'imtofront';
'autoredraw 0';
options results;
'newtargetted '||256||' '||256||' "'||gxname||'"'
if rc ~= 0 then do; 'options'; "message Can't allocate buffer!"; 'autoredraw 1'; 'finish'; exit 0; end;
bnum = result;
'backin '||bnum;
plugadr = result;
options;
'lockimage '||bnum;
address command cmdpath||'GE_NMRRD d'||plugadr||' "'||fullname||'" '||dbits||' '||hilo;
'unlockimage '||bnum;
'imtofront';
'autoredraw 1';
'finish';
exit 0;
/* --------------------------------------------------------------------- */
/* ---------------- END of format-specific ARexx code ------------------ */
/* --------------------------------------------------------------------- */
gimmepath:
arg fullnamegx;
tempgx = reverse(fullnamegx);
lengx = length(fullnamegx); /* get length of string */
slashdex = index(tempgx,'/'); /* first occurance of '/' from right */
colondex = index(tempgx,':'); /* first occurance of ':' from right */
seploc = 0; /* assumes current dir, no path supplied */
if slashdex ~= 0 then do /* we assume we are in a DIR */
seploc = (lengx - slashdex)+1;
end;
else do
if colondex ~= 0 then do /* we assume we are on a device */
seploc = (lengx - colondex)+1;
end;
end;
gxname = substr(fullnamegx,seploc+1); /* if you ever need it */
gxpath = left(fullnamegx,seploc);
return(gxpath);
expandfilename:
parse arg jfile;
if index(jfile,':') = 0 then do
curdir = pragma(D);
if right(curdir,1) ~= ':' then do
if right(curdir,1) ~= '/' then do
if curdir ~= '' then do
curdir = curdir || '/';
end;
end;
end;
jfile = curdir||jfile;
end;
return(jfile);